﻿//
var pIndex = 1; //当前第几页
var pSize = 20; //默认每页分页量
var curSelect = 0; //当前选项卡（多个切换）
var ps = $("#perPageCout").val();
if (ps != null)
    pSize = $("#perPageCout").val();
/*
1通用方法
2获取参数返回数据列表
3curSelect 用于多个选项卡切换，无则不处理
loadList(curSelect);
*/
//选择每页分页量
function loadPageSizeList(pindex, psize) {
    pIndex = 1;
    pSize = psize;
    loadList(curSelect);
}
//第几页
function loadPageList(pindex) {
    pIndex = pindex;
    loadList(curSelect);
}
//查询
function selectList() {
    loadList(curSelect);
}
//for 弹出页begin
//选择每页分页量
function loadPageSizeList2(pindex, psize) {
    pIndex = 1;
    pSize = psize;
    loadList2(curSelect); //暂时解决弹出窗的翻页 wangdy
}
//第几页
function loadPageList2(pindex) {
    pIndex = pindex;
    loadList2(curSelect);
}
//查询
function selectList2() {
    loadList2(curSelect);
}
//for 弹出页end
//输入跳转(回车)
function jumpPage(ev, num, maxnum) {
    if (ev.keyCode == 13) {
        if (isNaN(num)) {
            num = 1;
        } else {
            if (num > maxnum) {
                num = maxnum;
            }
        }
        loadPageList(num);
    }
}
//切换时初始化第一页
function initDt() {
    pIndex = 1;
}

//列表
//！！！很奇怪，必须加空行，否则总在弹出层上抛出脚本错误。

function Linelist(htmlname, pars, name, tName, control, dtnum, states, param) {
    //
    //alert(pars);
    $("#" + htmlname).load(
            "/OperateTotal/SearchListDistinct",
            {
                pars: pars,
                name: name,
                tName: tName,
                control: control,
                pageindex: pIndex,
                pagesize: pSize,
                dtnum: dtnum,
                states: states

            }, function () {
                if (isDWZInit) {
                    var sId = "#" + htmlname;
                    initUI(sId);
                }
            }
        );

        }
        function LineCruiselist(htmlname, pars, name, tName, control, dtnum, states, param) {
            //
            //alert(pars);
            $("#" + htmlname).load(
            "/OperateTotal/SearchCruiseListDistinct",
            {
                pars: pars,
                name: name,
                tName: tName,
                control: control,
                pageindex: pIndex,
                pagesize: pSize,
                dtnum: dtnum,
                states: states

            }, function () {
                if (isDWZInit) {
                    var sId = "#" + htmlname;
                    initUI(sId);
                }
            }
        );

        }
function list(htmlname, pars, name, tName, control, dtnum, states,param) {
    //
    //alert(pars);
    $("#" + htmlname).load(
            "/OperateTotal/SearchList",
            {
                pars: encodeURI(pars),
                name: name,
                tName: tName,
                control: control,
                pageindex: pIndex,
                pagesize: pSize,
                dtnum: dtnum,
                states: states

            }, function () {
                if (isDWZInit) {
                    var sId = "#" + htmlname;
                    initUI(sId);
                }
            }
        );
            
}


//供应商列表。
//！！！很奇怪，必须加空行，否则总在弹出层上抛出脚本错误。

function supplierList(htmlname, pars, name, tName, control, dtnum, states, selectColumns, sortColum,con) {
    //
   
    $("#" + htmlname).load(
            "/OperateTotal/supplierList",
            {
                pars: encodeURI(pars),
                name: name,
                tName: tName,
                control: control,
                pageindex: pIndex,
                pagesize: pSize,
                dtnum: dtnum,
                states: states,
                selectColum: selectColumns,
                sortColum: sortColum,
                con:con==null?"":con
            }, function () {
                if (isDWZInit) {
                    var sId = "#" + htmlname;
                    initUI(sId);
                }
            }
        );
        }


        function getMoreList(func,htmlname,pId, control, dtnum,type) {
            //
            //alert(pars);
            $("#" + htmlname).load(
            func,
            {
                pId: pId,
                control: control,
                pageindex: pIndex,
                pagesize: pSize,
                dtnum: dtnum,
                type:type

            }, function () {
                if (isDWZInit) {
                    var sId = "#" + htmlname;
                    initUI(sId);
                }
            }
        );

        }

        function getCommonList(func, htmlname, control) {
            $("#" + htmlname).load(
            func,
            {
                control: control,
                pageindex: pIndex,
                pagesize: pSize

            }, function () {
                if (isDWZInit) {
                    var sId = "#" + htmlname;
                    initUI(sId);
                }
            }
        );

        }
